import pytest
import sys
from pathlib import Path
import yaml
from fastapi.testclient import TestClient
from app.main import app

# 添加项目根目录到Python路径
project_root = Path(__file__).parent.parent
sys.path.insert(0, str(project_root)) 

@pytest.fixture
def client():
    return TestClient(app)

@pytest.fixture
def server_config():
    """获取服务器配置，用于测试"""
    config_path = Path(__file__).parent.parent / "config" / "server.yaml"
    with open(config_path) as f:
        return yaml.safe_load(f)["server"] 